home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlib43 / mntlib / lib.h < prev    next >
C/C++ Source or Header  |  1994-01-15  |  4KB  |  121 lines

  1. /*
  2.  * library-specific stuff
  3.  */
  4. #ifndef _LIB_H
  5. #define _LIB_H
  6.  
  7. #ifndef _COMPILER_H
  8. #include <compiler.h>
  9. #endif
  10.  
  11. #include <stdio.h>    /* for FILE   */
  12. #include <time.h>    /* for time_t */
  13.  
  14. /* filename mapping function type */
  15. #ifndef __FNMAP
  16. #define __FNMAP
  17. typedef int (*fnmapfunc_t) __PROTO((const char *, char *));
  18. #endif
  19.  
  20. __EXTERN int        _unx2dos __PROTO((const char *, char *));
  21. __EXTERN int        _dos2unx __PROTO((const char *, char *));
  22. #ifndef __MINT__
  23. __EXTERN int        unx2dos __PROTO((const char *, char *));
  24. __EXTERN int        dos2unx __PROTO((const char *, char *));
  25. __EXTERN void        fnmapfunc __PROTO((fnmapfunc_t u2dos, fnmapfunc_t dos2u));
  26. #endif
  27. __EXTERN int        _path_dos2unx __PROTO((const char *, char *));
  28. __EXTERN int        _path_unx2dos __PROTO((const char *, char *));
  29.  
  30. __EXTERN long        _write      __PROTO((int, const void *, unsigned long));
  31. __EXTERN long        _read      __PROTO((int, void *, unsigned long));
  32. #ifndef __MINT__
  33. __EXTERN int        console_input_status __PROTO((int));
  34. __EXTERN unsigned int    console_read_byte __PROTO((int));
  35. __EXTERN void        console_write_byte __PROTO((int, int));
  36. #else
  37. __EXTERN int    _console_read_byte __PROTO((int));
  38. __EXTERN void    _console_write_byte __PROTO((int, int));
  39. #endif
  40.  
  41. __EXTERN time_t        _dostime __PROTO((time_t));
  42. __EXTERN time_t        _unixtime __PROTO((unsigned int, unsigned int));
  43.  
  44. __EXTERN char *        _itoa __PROTO((int, char *, int));
  45. __EXTERN char *        _ltoa __PROTO((long, char *, int));
  46. __EXTERN char *        _ultoa __PROTO((unsigned long, char *, int));
  47.  
  48. __EXTERN int        _doprnt __PROTO((int (*)(int, FILE *), FILE *, const char *, __VA_LIST__));
  49.  
  50. #ifdef __MINT__
  51. __EXTERN int    _scanf __PROTO((FILE *, int (*)(FILE *),
  52.             int (*)(int, FILE *), const char *, __VA_LIST__));
  53. #endif
  54.  
  55. __EXTERN long        get_sysvar __PROTO((void *var));
  56. __EXTERN void        set_sysvar_to_long __PROTO((void *var, long val));
  57.  
  58. __EXTERN void    _main        __PROTO((long, char **, char **));
  59. __EXTERN void    _init_signal    __PROTO((void));
  60. __EXTERN void     _monstartup    __PROTO((void *lowpc, void *highpc));
  61. __EXTERN void    __mcleanup    __PROTO((void));
  62. __EXTERN void    _moncontrol    __PROTO((long));
  63. __EXTERN void    _setstack    __PROTO((char *));
  64. __EXTERN void    _crtinit    __PROTO((void));
  65. __EXTERN void    _acc_main    __PROTO((void));
  66. __EXTERN __EXITING    __exit    __PROTO((long status)) __NORETURN;
  67.  
  68. __EXTERN void    _fclose_all_files __PROTO((void));
  69. /* from the TOS GCC library */
  70. /* 5/5/92 sb -- definitions needed in malloc.c and realloc.c */
  71.  
  72. struct mem_chunk 
  73.     {
  74.     long valid;
  75. #define VAL_FREE  0xf4ee0abcL
  76. #define VAL_ALLOC 0xa11c0abcL
  77.  
  78.     struct mem_chunk *next;
  79.     unsigned long size;
  80.     };
  81.  
  82. /* linked list of free blocks */
  83.  
  84. extern struct mem_chunk _mchunk_free_list;
  85.  
  86. /* status of open files (for isatty, et al.) */
  87.  
  88. #ifdef __MINT__
  89.  
  90. #define __NHANDLES 40
  91.  
  92. struct __open_file {
  93.     short    status;        /* whether or not it's a tty */
  94.     short    flags;        /* if a tty, its flags */
  95. };
  96.  
  97. #else
  98.  
  99. #define __NHANDLES    80
  100. struct __open_file {
  101.     unsigned short append:1;    /* 1 if O_APPEND set for this file */
  102.     unsigned short nodelay:1;    /* 1 if O_NDELAY set for this file */
  103.     unsigned short pipe:1;      /* 1 if O_PIPE set for this file */
  104.     unsigned short eclose:1;    /* 1 if close on exec is set for this file */
  105.     unsigned short status:2;    /* status FH_UNKNOWN | ISATTY | ISAFILE */
  106.     char       *filename;    /* filename of open file */
  107. };
  108.  
  109. #endif /* __MINT__ */
  110.  
  111. extern struct __open_file __open_stat[];
  112.   /* NOTE: this array is indexed by (__OPEN_INDEX(fd)) */
  113.  
  114. #define __OPEN_INDEX(x)    (((short)(x)) + 3)
  115.  
  116. #define FH_UNKNOWN    0
  117. #define FH_ISATTY    1
  118. #define FH_ISAFILE    2
  119.  
  120. #endif /* _LIB_H */
  121.